<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /*  for (let i = 11; i < 100; i++) {
             var ten = Math.floor((i / 10))
             var gwei = i % 10
             console.log(ten, gwei);
             var tenAddgwei = Math.pow(ten, 2) + Math.pow(gwei, 2)
             if (tenAddgwei === 100) {
                 console.log('阿里数：', i);
             }
         } */
        // 数组扁平化
        /*    arr = [1, 2, [3, 4, [5, 6]]]
           function arrflat(arr1) {
               return arr1.reduce((results, item) => {
                   return results.concat(Array.isArray(item) ? arrflat(item) : item)
               }, [])
           }
           console.log(arrflat(arr)); */
        /*    var arr = {}
           console.log(arr instanceof Array); */
        //call方法
        /*     Function.prototype.myApply = function (context, args) {
                //这里默认不传就是给window,也可以用es6给参数设置默认参数
                context = context || window
                args = args ? args : []
                //给context新增一个独一无二的属性以免覆盖原有属性
                const key = Symbol()
                context[key] = this
                //通过隐式绑定的方式调用函数
                context[key](...args)
            } */
        var person = {
            fullName: function () {
                return this.firstName + " " + this.lastName;
            }
        }
        var person1 = {
            firstName: "Bill",
            lastName: "Gates",
        }
        var person2 = {
            firstName: "Steve",
            lastName: "Jobs",
        }
    console.log(    person.fullName.call(person1));


    </script>
</body>

</html>